<!DOCTYPE html>
<html lang="en" ng-app="KingSign">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>King Admin</title>

  <link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900italic,900&subset=latin,greek,greek-ext,vietnamese,cyrillic-ext,latin-ext,cyrillic' rel='stylesheet' type='text/css'>

  <link rel="icon" type="image/png" sizes="16x16" href="assets/img/favicon-16x16.png">
  <link rel="icon" type="image/png" sizes="32x32" href="assets/img/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="96x96" href="assets/img/favicon-96x96.png">

  <!-- build:css({.tmp/serve,src}) styles/vendor.css -->
  <!-- bower:css -->
  <!-- run `gulp inject` to automatically populate bower styles dependencies -->
  <!-- endbower -->
  <!-- endbuild -->

  <!-- build:css({.tmp/serve,src}) styles/auth.css -->
  <!-- inject:css -->
  <!-- css files will be automatically insert here -->
  <!-- endinject -->
  <!-- endbuild -->
</head>
<body>
<main class="auth-main" ng-controller="SignController" ng-if="show">
  <div class="auth-block">
    <h1>注册 King Admin</h1>

    <form class="form-horizontal" ng-submit="save()">
      <div class="form-group">
        <label for="username" class="col-sm-2 control-label">用户名</label>

        <div class="col-sm-10">
          <input type="text" class="form-control" id="username" placeholder="用户名" ng-model="user.username"
                 required>
        </div>
      </div>
      <div class="form-group">
        <label for="password" class="col-sm-2 control-label">密码</label>

        <div class="col-sm-10">
          <input type="password" class="form-control" id="password" placeholder="密码" ng-model="user.password"
                 required>
        </div>
      </div>
      <div class="form-group">
        <label for="inputEmail3" class="col-sm-2 control-label">邮箱</label>

        <div class="col-sm-10">
          <input type="email" class="form-control" id="inputEmail3" ng-model="user.email" placeholder="邮箱">
        </div>
      </div>
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <button type="submit" class="btn btn-default btn-auth">注册</button>
          <a href="auth.html" class="forgot-pass">登录</a>
        </div>
      </div>
    </form>

    <div class="auth-sep"><span><span>or Sign up with one click</span></span></div>

    <div class="al-share-auth">
      <ul class="al-share clearfix">
        <li><i class="socicon socicon-facebook" title="Share on Facebook"></i></li>
        <li><i class="socicon socicon-twitter" title="Share on Twitter"></i></li>
        <li><i class="socicon socicon-google" title="Share on Google Plus"></i></li>
      </ul>
    </div>
  </div>
</main>
<div id="preloader" ng-show="!show">
  <div></div>
</div>
<!-- build:js(src) scripts/vendor.js -->
<!-- bower:js -->
<!-- run `gulp inject` to automatically populate bower script dependencies -->
<!-- endbower -->
<!-- endbuild -->

<script type="text/javascript">
    'use strict';

    angular.module('KingSign', [
        'ngResource',
        'toastr',
    ]).run(function ($timeout, $rootScope) {
        $timeout(function () {
            $rootScope.show = true;
        },3000);
    });
</script>
<script type="text/javascript">
    (function () {
        'use strict';

        angular.module('KingSign')
            .controller('SignController', function ($scope, $resource, $window,toastr) {

                $scope.user = {};
                $scope.save = function () {
                    $resource('api/sign', {}, {'sign': {method: 'POST'}})
                        .sign($scope.user, function (data) {
                            if (data.code == 0) {
                                $window.open('/', '_self');
                            }else{
                                toastr.warning(data.msg, "提示", {"progressBar": true,});
                            }
                        }, function (error) {
                            toastr.error(error, "提示", {"progressBar": true,});
                        });
                }
            });


    })();

</script>
<script type="text/javascript" color="255,192,203" opacity='0.9' zIndex="-1" count="200"
        src="//cdn.bootcss.com/canvas-nest.js/1.0.1/canvas-nest.min.js"></script>
</body>
</html>